<?php
/**
 * Created by PhpStorm.
 * User: aaasayok
 * Date: 2016/11/17
 * Time: 13:02
 */

$url = "http://www.qiushibaike.com/8hr/page/%s/";

$page = 1;

$url = sprintf($url, $page);
$page++;

$html = file_get_contents($url);

$regex = "/<div class=\"content-text\".*?>.*?<\/div>/ism";

if(preg_match_all($regex, $html, $matches)){
    echo "<pre>";

    foreach ($matches[0] as $key => $match) {
        $text = trim(strip_tags($match));
        var_dump($text);
    }
    //print_r($matches);
}else{
    echo '0';
}

//print_r($html);


